package org.jordens.jdbcspy.sync;

import java.util.*;

/**
 * An abstract implementation that takes care of handling DataUpdater registration.
 *
 * @author Adam Jordens
 */
public abstract class AbstractDataStreamer implements DataStreamer
{
    private final Set<DataUpdater> dataUpdaters = new HashSet<DataUpdater>();
    
    /**
     * {@inheritDoc}
     */
    public final void register(DataUpdater dataUpdater)
    {
        dataUpdaters.add(dataUpdater);
    }

    /**
     * {@inheritDoc}
     */
    public final void unregister(DataUpdater dataUpdater)
    {
        dataUpdaters.remove(dataUpdater);
    }

    /**
     * @return Currently registered DataUpdaters.
     */
    protected final Collection<DataUpdater> getRegisteredDataUpdaters()
    {
        return dataUpdaters;
    }
}
